package cn.hh.dictionary.service.impl;


import cn.hh.basic.service.impl.BasicServiceImpl;
import cn.hh.basic.util.PageList;
import cn.hh.dictionary.domain.Detail;
import cn.hh.dictionary.domain.Type;
import cn.hh.dictionary.mapper.DetailMapper;
import cn.hh.dictionary.mapper.TypeMapper;
import cn.hh.dictionary.query.TypeQuery;
import cn.hh.dictionary.service.ITypeService;
import cn.hh.org.domain.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeServiceImpl extends BasicServiceImpl<Type> implements ITypeService {
    @Autowired
    private DetailMapper detailMapper;
    @Autowired
    private TypeMapper typeMapper;
    @Override
    public PageList<Detail> findDetailById(TypeQuery query) {
        Integer total=detailMapper.queryCount(query);
        List<Detail> bags = detailMapper.queryData(query);
        PageList<Detail> pageList = new PageList<>(total, bags);
        return pageList;
    }
    /*级联删除*/
    @Override
    public void deleteById(Long id) {
        detailMapper.deleteAllById(id);
        typeMapper.deleteById(id);
    }
    /*级联批量删除*/
    @Override
    public void deleteByIds(Long[] ids) {
        detailMapper.deleteAllByIds(ids);
        typeMapper.deleteByIds(ids);
    }
}
